/*
 * @(#)MaintFormSectionForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.form.web;

import java.util.Hashtable;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.form.bean.FormSection;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.GlobalConstant;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;

/**
  MaintFormSectionForm.java

  This class is the for web form purpose.

  @author      Scott Tong
  @company     DCIVision Limited
  @creation date   20/12/2003
  @version     $Revision: 1.17 $
*/

public class MaintFormSectionForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.17 $";

  private String title = null;
  private String titleAlt = null;
  private String description = null;
  private String descriptionAlt = null;
  private String sectionFontColor = null;
  private String sectionFontSize = null;
  private String sectionFontType = null;
  private String fontStyleBold = null;
  private String fontStyleUnderline = null;
  private String fontStyleItalic = null;
  private String sectionFontStyle = null;
  private String sectionPosition= null;
  private String formRecordID = null;
  private String formGroupID = null;
  private String subSection = null;
  private String fieldName = null;
  private String status = GlobalConstant.RECORD_PENDING;
  private Object[][] pageElementArray = null;


  private List formElementList = null;
  private List formSectionList = null;
  private Hashtable elementHashtable = null;

  public MaintFormSectionForm() {
    super();
  }


  public String getFontStyleBold(){
        return this.fontStyleBold;
  }

  public void setFontStyleBold(String fontStyleBold) {
    this.fontStyleBold = fontStyleBold;
  }

  public String getFontStyleUnderline(){
        return this.fontStyleUnderline;
  }

  public void setFontStyleUnderline(String fontStyleUnderline) {
    this.fontStyleUnderline = fontStyleUnderline;
  }

  public String getFontStyleItalic(){
        return this.fontStyleItalic;
  }

  public void setFontStyleItalic(String fontStyleItalic) {
    this.fontStyleItalic = fontStyleItalic;
  }


  public String getTitle() {
    return(this.title);
  }

  public void setTitle(String title) {
    this.title = title;
  }

  public String getTitleAlt() {
    return(this.titleAlt);
  }

  public void setTitleAlt(String titleAlt) {
    this.titleAlt = titleAlt;
  }

  public String getDescription() {
    return(this.description);
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public String getDescriptionAlt() {
    return(this.descriptionAlt);
  }

  public void setDescriptionAlt(String descriptionAlt) {
    this.descriptionAlt = descriptionAlt;
  }

  public String getsectionFontColor() {
    return(this.sectionFontColor);
  }

  public void setsectionFontColor(String sectionFontColor) {
    this.sectionFontColor = sectionFontColor;
  }

  public String getsectionFontSize() {
    return(this.sectionFontSize);
  }

  public void setsectionFontSize(String sectionFontSize) {
    this.sectionFontSize = sectionFontSize;
  }

  public String getsectionFontType() {
    return(this.sectionFontType);
  }

  public void setsectionFontType(String sectionFontType) {
    this.sectionFontType= sectionFontType;
  }

  public String getsectionFontStyle() {
    return(this.sectionFontStyle);
  }

  public void setsectionFontStyle(String sectionFontStyle) {
    this.sectionFontStyle= sectionFontStyle;
  }

  public String getsectionPosition() {
    return(this.sectionPosition);
  }

  public void setsectionPosition(String sectionPosition) {
    this.sectionPosition= sectionPosition;
  }

  public String getFormRecordID() {
    return(this.formRecordID);
  }

  public void setFormRecordID(String formRecordID) {
    this.formRecordID = formRecordID;
  }

  public String getFormGroupID() {
    return(this.formGroupID);
  }

  public void setFormGroupID(String formGroupID) {
    this.formGroupID = formGroupID;
  }
  
  public String getSubSection() {
    return(this.subSection);
  }

  public void setSubSection(String subSection) {
    this.subSection = subSection;
  }

  public String getStatus() {
    return(this.status);
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String getFieldName() {
    return(this.fieldName);
  }

  public void setFieldName(String fieldName) {
    this.fieldName = fieldName;
  }

  public void setFormElementList(List FormElementList) {
    this.formElementList = FormElementList;
  }

  public List getFormElementList() {
    return (this.formElementList);
  }

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setTitle(null);
    this.setTitleAlt(null);
    this.setDescription(null);
    this.setDescriptionAlt(null);
    this.setsectionFontColor(null);
    this.setsectionFontSize(null);
    this.setsectionFontType(null);
    this.setsectionFontStyle(null);
    this.setsectionPosition(null);
    this.setFormRecordID(null);
    this.setSubSection(null);
    this.setStatus(GlobalConstant.RECORD_PENDING);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    FormSection tmpFormSection = new FormSection();
    tmpFormSection.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpFormSection.setTitle(this.getTitle());
    tmpFormSection.setTitleAlt(this.getTitleAlt());
    tmpFormSection.setDescription(this.getDescription());
    tmpFormSection.setDescriptionAlt(this.getDescriptionAlt());
    tmpFormSection.setsectionFontColor(this.getsectionFontColor());
    tmpFormSection.setsectionFontSize(this.getsectionFontSize());
    tmpFormSection.setsectionFontType(this.getsectionFontType());
    tmpFormSection.setsectionFontStyle(this.getsectionFontStyle());
    tmpFormSection.setsectionPosition(this.getsectionPosition());
    tmpFormSection.setRecordStatus(this.getRecordStatus());
    tmpFormSection.setSubSection(this.getSubSection());
    tmpFormSection.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpFormSection.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpFormSection.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpFormSection.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpFormSection.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpFormSection;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    FormSection tmpFormSection = (FormSection)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpFormSection.getID()));
    this.setTitle(tmpFormSection.getTitle());
    this.setTitleAlt(tmpFormSection.getTitleAlt());
    this.setDescription(tmpFormSection.getDescription());
    this.setDescriptionAlt(tmpFormSection.getDescriptionAlt());
    this.setsectionFontColor(tmpFormSection.getsectionFontColor());
    this.setsectionFontSize(tmpFormSection.getsectionFontSize());
    this.setsectionFontType(tmpFormSection.getsectionFontType());
    this.setsectionFontStyle(tmpFormSection.getsectionFontStyle());
    this.setsectionPosition(tmpFormSection.getsectionPosition());
    this.setRecordStatus(tmpFormSection.getRecordStatus());
    this.setSubSection(tmpFormSection.getSubSection());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpFormSection.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpFormSection.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpFormSection.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpFormSection.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpFormSection.getUpdateDate()));
  }

  public List getFormElementListData() throws ApplicationException {
   List tmpFormElementList = this.getFormElementList();
   return tmpFormElementList;
  }

  public void setFormElementListData(List elementList) throws ApplicationException {
   List formElementList = elementList;
   this.setFormElementList(formElementList);
  }

  public List getFormSectionListData() throws ApplicationException {
   return this.formSectionList;
  }

  public void setFormSectionListData(List sectionList) throws ApplicationException {
   this.formSectionList = sectionList;
  }

  public Hashtable getFormElementHashtable() throws ApplicationException {
   return this.elementHashtable;
  }

  public void setFormElementHashtable(Hashtable elementHashtable) throws ApplicationException {
   this.elementHashtable = elementHashtable;
  }
  
  public Object[][] getPageElementArray(){
  	return this.pageElementArray;
  }
  
  public void setPageElementArray(Object[][] pageElementArray) {
  	this.pageElementArray = pageElementArray;
  }
}
